package com.coderli.onecoder.agent;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.coderli.onecoder.agent.common.AgentClient;

/**
 * Aclome VIE服务端，用于跟Server端进行绑定和通信
 * 
 * @author lihzh
 * @date 2012-6-29 下午2:01:52
 */
public class AgentMain {

	private static final Logger log = LoggerFactory.getLogger(AgentMain.class);

	/**
	 * 启动Agent服务
	 * 
	 * @param args
	 *            <p>
	 *            -args[0] = 主机IP <br>
	 *            -args[1] = 主机端口号<br>
	 * @author lihzh
	 * @date 2012-6-29 下午2:01:52
	 */
	public static void main(String[] args) {
		if (args.length < 2) {
			log.error("Invalid arguments input. You must supply server ip and port to bind.");
			throw new IllegalArgumentException(
					"The args length you input is less than 2.");
		}
		String serverIp = args[0];
		int serverPort = Integer.valueOf(args[1]);
		AgentClient client = new AgentClient(serverIp, serverPort);
		// 跟服务端绑定
		client.bindToServer();
	}

}
